package com.xiaoyy.app.extend.gateway.controller;

import com.xiaoyy.app.extend.common.vo.SrcmPersonVO;
import com.xiaoyy.app.extend.integration.RcmIntegration;
import com.xiaoyy.core.common.exception.AppException;
import com.xiaoyy.core.common.vo.AppResponse;
import com.xiaoyy.core.common.vo.TokenVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 人才码相关
 *
 * @author chenzh
 * @date 2020-12-11
 */
@RestController
@RequestMapping(value = "/rcm")
@Api(tags = "人才码管理")
public class RcmController {
    @Autowired
    RcmIntegration rcmIntegration;
    /**
     * 获取人员信息
     * */
    @RequestMapping(value = "/zlb/checkToken", method = {RequestMethod.POST,RequestMethod.GET})
    @ApiOperation(value = "根据token校验省人才码token", notes = "根据token校验省人才码token")
    public AppResponse<TokenVO> checkToken(@ApiParam(name = "token") @RequestParam("token") String token) {
        return AppResponse.successData(rcmIntegration.checkToken(token));
    }
    /**
     * 根据身份证获取省人才信息
     * */
    @RequestMapping(value = "/getPerson/byIdcard", method = {RequestMethod.POST})
    @ApiOperation(value = "根据身份证获取省人才信息", notes = "根据身份证获取省人才信息")
    public AppResponse<SrcmPersonVO> getPersonByIdcard(@RequestBody SrcmPersonVO vo) {
        return AppResponse.successData(rcmIntegration.getSrcmPerson(vo));
    }
}
